#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <iomanip>
#include <numeric>
// #include <unordered_map>
#include <map>
using namespace std;
typedef long long ll;

const int N=2e4+5;

int n,m,len,rt,cnt;

void solve(int n,int m){
	vector<vector<int> > adj(n);
	vector<int>dfn(n),low(n),fa(n),res(n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	auto dfs=[&](this auto&& dfs,int u)->void{
		dfn[u] = low[u] = ++len;
		int son = 0;
		for(int v:adj[u]){
			if(dfn[v] == 0){
				son++;
				dfs(v);
				low[u] = min(low[u],low[v]);
				if(low[v] >= dfn[u] && u != rt){
					res[u]++;
				}
			}
			else low[u] = min(low[u],dfn[v]);
		}
		if(son >= 2 && rt == u) res[u]+=son-1;
	};

	for(int i=0;i<n;i++){
		if(dfn[i]==0)rt=i,cnt++,dfs(i);
	}
	int mx=-1,mxn=-1;
	for(int i=0;i<n;i++){
		if(res[i]>mxn)mxn=res[i],mx=i;
	}
	if(adj[mx].size()==0)cout<<cnt-1<<' ';
	cout<<cnt+res[mx]<<' ';
	len=0,cnt=0;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    while(cin>>n>>m){
    	if(n==0&&m==0)break;
    	solve(n,m);
    }
    return 0;
}